package com.itheima.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 用户消息对象 account_message
 *
 * @author guanhuaer
 * @date 2025-03-19
 */
@Data
public class AccountMessage
        {
private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /** 用户id */
    @ApiModelProperty("用户id")
    private Long userId;
    /** 消息标题 */
    @ApiModelProperty("消息标题")
    private String title;
    /** 消息内容 */
    @ApiModelProperty("消息内容")
    private String description;
    /** 消息类型(0通知,1消息,2待办) */
    @ApiModelProperty("消息类型(0通知,1消息,2待办)")
    private Long type;
    /** 图标 */
    @ApiModelProperty("图标")
    private String avatar;
    /** 创建时间 */
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date datetime;
    /** 状态 */
    @ApiModelProperty("状态")
    private String extra;
    /** 状态颜色 */
    @ApiModelProperty("状态颜色")
    private String status;
    /** 是否已读 */
    @ApiModelProperty("是否已读,0未读,1已读")
    private Long isRead;
    public String getAvatar() {
        if (type!=null){
            if (type==0){
                return "https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png";
            }else if (type==1){
                return "https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png";
            }
        }
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }
        }
